package com.hyzx.qbasic.admin.controller;

import com.hyzx.qbasic.admin.common.security.ShiroUtils;
import com.hyzx.qbasic.admin.model.dto.MenuInfo;
import com.hyzx.qbasic.admin.domain.service.IPermissionService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by 黄江华 on 2017/9/8
 * Controller基类
 */

public class BaseController {

    protected Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private IPermissionService permissionService;

    public MenuInfo getFunction(String permission){
        int userId= ShiroUtils.getCurrentUserId();
        return permissionService.getFunction(userId,permission).orElse(null);
    }
}
